import qs from 'qs'
import request from '@/utils/request'
// 查询设备对应列表，树状图还没写好，目前参数写死
export const getshebeilistapi = data => request.get(`/core/iot/config/device-item/list?deviceId=${data.deviceId}&itemGroup=${data.itemGroup}`)
// 查询采集设备下拉框
export const getsbxialaapi = data => request.get(`/core/iot/config/device-item/meter/combo-items?deviceId=${data.deviceId}`)
// 查询已启用测点模板列表
export const getyiqilistapi = data => request.get(`/core/iot/config/item-template/enabled/list?itemGroup=${data.itemGroup ? data.itemGroup : ''}&itemLoop=${data.itemLoop}&iotDeviceId=${data.iotDeviceId}`)
// 获取树状图根节点信息
export const getgenjiedianapi = params => request.get(`/core/vom/device-tree/root-node/list?treeModel=${params.treeModel}`)
// 获取树状图子节点信息
export const getzijidianapi = data => request.post('/core/vom/device-tree/child-node/list', data)
// export const getzhidingapi = data => request.get(`/vom/device-tree/dev-node/list?entityId=${data.entityId}&entityModel=${data.entityModel}&treeModel=${data.treeModel}`)
// 根据关键字搜索树节点
export const getsousuoapi = data => request.get(`/core/vom/device-tree/simple-device/list?name=${data.name}`)
// 新增模板类型
export const getxinmubanapi = data => request.post(`/core/iot/config/device-item/refer-to-template?deviceId=${data.deviceId}&iotDeviceId=${data.iotDeviceId}&templateId=${data.templateId}`)
// 复制设备下拉框
export const getfuzhiapi = data => request.get(`/core/iot/config/device-item/refer-to-device/combo-items?deviceId=${data.deviceId}`)
// 采集设备下拉框
export const getcaijiapi = data => request.get(`/core/iot/config/device-item/meter/combo-items?deviceId=${data.deviceId}`)
// 复制新增
export const postfuzizenapi = data => request.post(`/core/iot/config/device-item/refer-to-device?deviceId=${data.deviceId}&iotDeviceId=${data.iotDeviceId}&referDeviceId=${data.referDeviceId}`)
// 新增测点类型
export const postxinceapi = data => request.post(`/core/iot/config/device-item?deviceId=${data.deviceId}&iotDeviceId=${data.iotDeviceId}&itemTag=${data.itemTag}`)
// 批量删除/删除
export const dellistapi = data => request.post(`/core/iot/config/device-item/delete?id=${data.id}`)
// 删除枚举
export const delmeijucedianapi = data => request.post(`/core/iot/config/device-item/enum-item/delete?enumValue=${data.enumValue}&id=${data.id}`)
// 添加枚举
export const pustmeijucedianapi = data => request.post(`/core/iot/config/device-item/enum-item/put?enumName=${data.enumName}&enumValue=${data.enumValue}&id=${data.id}`)
// 批量修改
export const putpiliangapi = data => request.post('/core/iot/config/device-item/batch-edit', data)
// 上移设备测点
export const postshangyiapi = data => request.post(`/core/iot/config/device-item/move-up?id=${data.id}`)
// 下移设备测点
export const postxiayiapi = data => request.post(`/core/iot/config/device-item/move-down?id=${data.id}`)
// 下载模版
export const getmubanapi=deviceId=>request.post(`pio-microservice-biz/pio/equip/measure/point/set/day/user/exportExcel?deviceId=${deviceId}`,{responseType: 'arraybuffer'})
// 导入
export const postdaoruapi=(deviceId,iotDeviceId,formData)=>request.post(`pio-microservice-biz/pio/equip/measure/point/set/import?deviceId=${deviceId}&iotDeviceId=${iotDeviceId}`,formData, {
  headers: {
    'Content-Type': 'multipart/form-data'
  }
})
